package com.totoro.springboot.kafka_demo.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by Niki on 2018/5/12 10:12
 */
@Service
@Slf4j
public class MessageSendService {
    @Resource
    KafkaTemplate kafkaTemplate;

    public void send(String topic, String message) {
        kafkaTemplate.send(topic, message);
        log.info("kafka 向topic:{},发送消息:{}",topic, message);
    }
}
